import { createRouter, createWebHistory } from 'vue-router'

import Routermap from './router.js'

export const constantRouterMap = [
  { path: '/login', component: () => import('../views/Login/index.vue'), hidden: true },
  { path: '/404', component: () => import('../views/Error/404.vue'), hidden: true },
  { path: '/401', component: () => import('../views/Error/401.vue'), hidden: true }
]

const Router = createRouter({
  history: createWebHistory(),
  scrollBehavior: () => ({ top: 0 }),
  routes: constantRouterMap
})

export default Router

export const asyncRouterMap = [
  ...Routermap,
  { path: '/:pathMatch(.*)*', redirect: '/404', hidden: true }
]
